package Song.Han.day03.demo02;

public class Demo03PhoneSame {

    public static void main(String[] args) {
        Phone one = new Phone();
        System.out.println(one.brand);//null
        System.out.println(one.price);//0.0
        System.out.println(one.color);//null
        System.out.println("--------------------------");
        one.brand = "三星";
        one.price = 5999;
        one.color = "黑色";
        System.out.println(one.brand);//三星
        System.out.println(one.price);//5999.0
        System.out.println(one.color);//黑色
        System.out.println("--------------------------");
        one.call("张三");
        one.text("张三","Hello!");
        System.out.println("==========================");

        //把one对象赋值给two
        Phone two = one;
        System.out.println(two.brand);//三星
        System.out.println(two.price);//5999.0
        System.out.println(two.color);//黑色
        System.out.println("--------------------------");
        two.brand = "华为";
        two.price = 6999;
        two.color = "蓝色";
        System.out.println(two.brand);//华为
        System.out.println(two.price);//6999
        System.out.println(two.color);//蓝色
        System.out.println("--------------------------");
        two.call("李四");
        two.text("李四", "你好!");
        System.out.println("==========================");

        //one&two 两个对象名共用一个对象
        System.out.println(one.brand);//华为
        System.out.println(one.price);//6999
        System.out.println(one.color);//蓝色


    }
}

